package com.cos.hospital.tool;

import com.cos.hospital.model.bean.PatientListBean;

import java.util.Comparator;

/**
 * 以首字母来排序
 */
public class PatientPinComparator implements Comparator<PatientListBean.ItemsBean> {

    public int compare(PatientListBean.ItemsBean o1, PatientListBean.ItemsBean o2) {
        //这里主要是用来对ListView里面的数据根据ABCDEFG...来排序
        if (o2.getLetter().equals("#")) {
            return -1;
        } else if (o1.getLetter().equals("#")) {
            return 1;
        } else {
            return o1.getLetter().compareTo(o2.getLetter());
        }
    }
}
